<?php
$sub_menu = "230460";
include_once("./_common.php");

check_demo();

auth_check($auth[$sub_menu], "w");

check_token();

for ($i=0; $i<count($chk); $i++) 
{
    // 실제 번호를 넘김
    $k = $_POST['chk'][$i];

    $ml_id = $_POST[ml_id][$k]; 

    $row = sql_fetch("select * from $mw_cash[membership_log_table] where ml_id = '$ml_id'");
    if (!$row)
        alert("자료가 없습니다.");

    $log = $row[ml_log];
    if (!trim($log)) {
        $ms = sql_fetch(" select * from $mw_cash[membership_table] where ms_id = '$row[ms_id]'");
        $log = "[$row[ml_datetime]] ($ms[ms_name] $row[ml_day]일) $row[ml_sdate] ~ $row[ml_edate]\n";
    }

    $ms = sql_fetch(" select * from $mw_cash[membership_table] where ms_id = '$ms_id'");
    $log.= "[$g4[time_ymdhis]] ($ms[ms_name] $row[ml_day]일) $row[ml_sdate] ~ $row[ml_edate]\n";

    $sql = "update $mw_cash[membership_log_table] set ms_id = '$ms_id', ml_log = '$log' where ml_id = '$ml_id'";
    sql_query($sql);
}

goto_url("mw.membership.log.php?ms_id=$old_ms_id&mi_day=$mi_day&acc=$acc$qstr");
